3.x: add ability to add multiple optional parameters to table scopes#226
Merged
3.x: add ability to add multiple optional parameters to table scopes#226
Conversation
ADmad
reviewed
Jan 6, 2023
markstory
reviewed
Jan 7, 2023
| * @return mixed The modified resource. | ||
| */ | ||
| public function applyScope(string $action, mixed $resource): mixed; | ||
| public function applyScope(string $action, mixed $resource, mixed ...$optionalArgs): mixed; |
Member
There was a problem hiding this comment.
This will be a breaking change as user-land code will have implemented this interface. We should add this to the documentation/migration guide.
Contributor
Author
There was a problem hiding this comment.
Indeed. I was just curious if you guys even like this idea or not 😄
The first version of the 3.0 migration guide has been added with the major changes I have seen via looking at 2.x...3.x-scope-params
markstory
reviewed
Jan 10, 2023
| 'secondArg' => false, | ||
| ]) | ||
| ->willReturn($query); | ||
| $result = $service->applyScope($user, 'additionalArguments', $query, 'first argument', false); |
Member
There was a problem hiding this comment.
Will these changes also enable the use of named parameters? eg. applyScope($user, category: $category)
Contributor
Author
There was a problem hiding this comment.
I have added a test which proves it works 😉
This was referenced Apr 25, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #225